<!DOCTYPE html>
<html>
<head>

    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">

</head>

<body>

系统载入中，请稍等...

<?php
//验证登陆信息
session_start();

include_once("../config.php");
include_once '../connection.php';

$account = $_POST['account'];
$name = $_POST['name'];
$password = $_POST['password'];
$repassword = $_POST['repassword'];
$email = $_POST['email'];
$phone = $_POST['phone'];



$code = $_POST['code'];


$unit['ai_mid']=$_POST['account'];
$unit['ai_mima']=md5($_POST['password']);
$unit['ai_name']=$_POST['company'];
$unit['ai_email']=$_POST['email'];
$unit['ai_phone']=$_POST['phone'];

/*$regcode = strrev(substr($phone+1234,7));
if($code!=$regcode){
    echo "<script language='javascript'>alert('验证码错误！');location='register.php';</script>";
    exit;
}*/

if (!preg_match("/^[0-9a-zA-Z]{6,12}$/", $account)) {echo "<script language='javascript'>alert('非法用户名！');location='register.php';</script>"; exit;}
if (strlen($password) < 6 && strlen($password) > 12 ) {echo "<script language='javascript'>alert('请输入正确的密码长度！');location='register.php';</script>";}
if($password != $repassword){echo "<script language='javascript'>alert('密码不匹配！');location='register.php';</script>";}




$_check_member=select_one_line_all_items($table_prefix."unit","account='mid'");



if ($_check_member['nid']) {
    echo "<script language='javascript'>alert('该账号已存在！');location='register.php';</script>";
} else{

    if(isset($_FILES['images1']) && $_FILES['images1']['size'] > 2000000 ){
        echo "<script language='javascript'>alert('图片过大，只支持2M以下！');location='register.php';</script>";
    }
    if(isset($_FILES['images2']) && $_FILES['images2']['size'] > 2000000 ){
        echo "<script language='javascript'>alert('图片过大，只支持2M以下！');location='register.php';</script>";
    }
    if(isset($_FILES['images3']) && $_FILES['images3']['size'] > 2000000 ){
        echo "<script language='javascript'>alert('图片过大，只支持2M以下！');location='register.php';</script>";
    }

//===========上传Banner===========
    if (is_uploaded_file($_FILES['images1']['tmp_name'])) {
        $prom1["upfile"] = $_FILES["images1"];
        $prom1["path"] = '../uploadfiles/';
        $prom1["allowExt"] = array('jpeg', 'jpg', 'png', 'gif', 'bmp');
        $file1 = upload_file($prom1);

        $unit['ai_images1'] = $file1['name'];

    }


//===========上传Banner===========
    if (is_uploaded_file($_FILES['images2']['tmp_name'])) {
        $prom2["upfile"] = $_FILES["images2"];
        $prom2["path"] = '../uploadfiles/';
        $prom2["allowExt"] = array('jpeg', 'jpg', 'png', 'gif', 'bmp');
        $file2 = upload_file($prom2);

        $unit['ai_images2'] = $file2['name'];
    }


//===========上传Banner===========
    if (is_uploaded_file($_FILES['images3']['tmp_name'])) {
        $prom3["upfile"] = $_FILES["images3"];
        $prom3["path"] = '../uploadfiles/';
        $prom3["allowExt"] = array('jpeg', 'jpg', 'png', 'gif', 'bmp');

        $file3 = upload_file($prom3);

        $unit['ai_images3'] = $file3['name'];
    }


    $_new_unit=insert_data($table_prefix."unit",$unit);

    $query = mysql_query($_new_unit) or die ("error:".mysql_error());
    mysql_close($con);

    echo '<script type="text/javascript">alert("注册成功，待通过审核，点击确认返回继续操作.");document.location.href = "index.php";</script>';
}


?>
</body>